package com.wang.gallerybackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 图片审核状态枚举枚举
 * @author 汪
 */
@Getter
public enum PictureReviewStatusEnum {

	UNREVIEWED("待审核", 0),

	REVIEW_PASS("审核通过", 1),

	REVIEW_FAIL("审核失败", 2);

	private final String text;

	private final int value;

	PictureReviewStatusEnum(String text, int value) {
		this.text = text;
		this.value = value;
	}

	/**
	 * 根据value获取枚举
	 * @param value 枚举值
	 * @return 枚举
	 */
	public static PictureReviewStatusEnum getEnumByValue(Integer value) {
		if (ObjUtil.isEmpty(value)) {
			return null;
		}
		for (PictureReviewStatusEnum pictureReviewStatusEnum : PictureReviewStatusEnum.values()) {
			if (pictureReviewStatusEnum.value==value) {
				return pictureReviewStatusEnum;
			}
		}
		return null;
	}
}
